package java_thinking.unit_10._10_6;

/**
 * @Description :   对原先game工厂的匿名内部类写法
 * @author: cww
 * @DateTime: 2019-03-10 18:16
 */
interface Game {
    boolean move();
}
interface GameFactory{
    Game getGame();
}

class Checker implements Game{

    @Override
    public boolean move() {
        return false;
    }

    public static GameFactory gameFactory = new GameFactory() {
        @Override
        public Game getGame() {
            return new Checker();
        }
    };
}

class PlayGame{
    public static void gameConsumer(GameFactory factory){
        Game game = factory.getGame();
        game.move();
    }

    public static void main(String[] args) {
        gameConsumer(Checker.gameFactory);
    }
}